home *** CD-ROM | disk | FTP | other *** search
- #include <Gestalt.h>
- #include <Patches.h>
- #include <Resources.h>
- #include <TextUtils.h>
- #include <Types.h>
-
- //============================================================================
-
- long SetA4(long:__D0):__D0 = 0xC18C;
-
- //============================================================================
-
- pascal
- OSErr
- (*gOldGestalt)
- (
- OSType selector:__D0,
- long * response:__A1
- ):__D0;
-
- //============================================================================
-
- asm
- OSErr
- GestaltPatch
- (
- OSType selector:__D0,
- long * response:__A1
- ):__D0;
-
- //============================================================================
-
- asm
- OSErr
- GestaltPatch
- (
- OSType selector:__D0,
- long * response:__A1
- ):__D0
- {
- link a6,#0
- movem.l d3-d5/a2,-(a7)
- move.l d0,d5
- movea.l a1,a2
- moveq #0,d3
- jsr 0(a4)
- ext.l d0
- move.l d0,d4
- cmpi.l #1397770785,d5
- bne.s *+10 ; 0x00000026
- move.l #-559038737,(a2)
- bra.s *+14 ; 0x00000032
- movea.l 0(a4),a0
- move.l d5,d0
- movea.l a2,a1
- jsr (a0)
- move.w d0,d3
- move.l d4,d0
- exg d0,a4
- moveq #0,d0
- movem.l (a7)+,d3-d5/a2
- unlk a6
- rts
- /*
- OSErr err = noErr;
- long oldA4;
- Str255 debugInfo;
-
- oldA4 = SetCurrentA4();
-
- if (selector == 'SPJ!')
- {
- *response = 0xdeadbeef;
- }
- else
- {
- err = gOldGestalt(selector, response);
- }
-
- SetA4(oldA4);
-
- return noErr;
- */
- }
-
- //============================================================================
-
- void main (void)
- {
- long oldA4 = SetCurrentA4();
- Str255 debugInfo;
-
- gOldGestalt =
- (pascal OSErr (*)(OSType selector:__D0, long* response:__A1):__D0)
- NGetTrapAddress(0xA1AD, kOSTrapType);
-
- NSetTrapAddress((UniversalProcPtr)GestaltPatch, 0xA1AD, kOSTrapType);
-
- DetachResource(GetResource('INIT', 0));
-
- SetA4(oldA4);
- }
-
- //============================================================================
-
-